package com.atguigu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Author：YH
 * @Description：order已经注册到zookeeper当中，消费者利用restTemplate实现对生产者支付模块的调用
 * @Date:Created in 2021/5/2 10:54
 */
@RestController
@Slf4j
public class OrdeZk {


    public static final String INVOKE_URL = "http://cloud-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping(value = "/consumer/payment/zk")
    public String paymentInfo() {
        String result = restTemplate.getForObject(INVOKE_URL + "/payment/zk", String.class);
        log.info("URL地址为" + INVOKE_URL);
        return restTemplate.getForObject(INVOKE_URL + "/payment/zk", String.class);
    }
}
